<template>
  <div class="dashboard-container">
    <component :is="currentRole" />
  </div>
</template>

<script>
import { mapGetters } from "vuex";
import adminDashboard from "@/views/dashboard/admin/index.vue";
import editorDashboard from "@/views/dashboard/reader/reader.vue";

export default {
  name: "Dashboard",
  components: { adminDashboard, editorDashboard },
  data() {
    return {
      currentRole: "adminDashboard",
      roles: ""
    };
  },
  computed: {
    currentUser() {
      return this.roles = this.$store.state.account.user.roleId;
    }
  },
  created() {
    this.roles = this.$store.state.account.user.roleId
    if (!(this.roles.includes("1") || this.roles.includes("3"))) {
      this.currentRole = "editorDashboard";
    }
  }
};
</script>
